import request from '@/utils/request'
// 设备管理
export function getShebeiLeixing(params) {
  return request({
    url: `/api/vm-service/vm/search`,
    params
  })
}
// 新增售货机
export function addShopCar(data) {
  return request({
    method: 'post',
    url: `/api/vm-service/vm`,
    headers: {
      'Content-Type': 'application/json'
    },
    data
  })
}
// 售货机型号列表
export function getvmTypeList(params) {
  return request({
    url: `/api/vm-service/vmType/search`,
    params
  })
}
// 点位列表
export function getnodeList(params) {
  return request({
    url: `/api/vm-service/node/search`,
    params
  })
}
// 策略列表行⭐
export function getIdeaList(params) {
  return request({
    url: `/api/vm-service/policy`,
    params
  })
}
// 应用策略⭐
export function putIdea(data) {
  return request({
    url: `/api/vm-service/vm/applyPolicy`,
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'put',
    data
  })
}

// 查询售货机策略
export function getShouhuojiCelue(innerCode) {
  return request({
    url: `/api/vm-service/policy/vmPolicy/${innerCode}`
  })
}

// 取消策略
export function quxiaoCelue(innerCode, policyId) {
  return request({
    url: `/api/vm-service/vm/cancelPolicy/${innerCode}/${policyId}`,
    method: 'put'
  })
}
// 修改售货机点位
export function putdianwei(id, nodeId) {
  return request({
    url: `/api/vm-service/vm/${id}/${nodeId}`,
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'put'
  })
}

// 获取货道
export function getShouhuojiHuodao(innerCode) {
  return request({
    url: `/api/vm-service/channel/channelList/${innerCode}`
  })
}
// 智能排货
export function getzhinengpaihuo(businessId) {
  return request({
    url: `/api/vm-service/sku/businessTop10/${businessId}`
  })
}
// 获取智能排货位置
export function getzhinengpaihuoquyu(businessId) {
  return request({
    url: `/api/vm-service/businessType/name/${businessId}`
  })
}
// 获取添加商品列表
export function getaddshangpingList() {
  return request({
    url: `/api/vm-service/sku/search`,
    params: {
      pageIndex: 1,
      pageSize: 1000
    }
  })
}
// 搜索
export function getsousuoList(skuName) {
  return request({
    url: `/api/vm-service/sku/search`,
    params: {
      pageIndex: 1,
      pageSize: 1000,
      skuName
    }
  })
}

// ⭐设备状态
// 获取设备管理列表
export function getVmList(params) {
  return request({
    url: `/api/vm-service/vm/search`,
    params
  })
}
// 获取商品售货机商品销量详情
export function getGoodsDetail(params) {
  return request({
    url: `/api/order-service/report/skuCollect`,
    method: 'GET',
    params
  })
}
// 获取一定时间范围之内的收入
export function getAccount(start, end, innerCode) {
  return request({
    url: `/api/order-service/report/orderAmount?start=${start}&end=${end}&innerCode=${innerCode}`

  })
}
// 获取一定时间范围之内的订单总数
export function getOrderCount(start, end, innerCode) {
  return request({
    url: `/api/order-service/report/orderCount?start=${start}&end=${end}&innerCode=${innerCode}`

  })
}
// 获取售货机补货次数
export function getsupplyCount(innerCode, start, end, params) {
  return request({
    url: `/api/task-service/task/supplyCount/${innerCode}/${start}/${end}`,
    params
  })
}
// 获取售货机维修次数
export function getReqiureCount(innerCode, start, end, params) {
  return request({
    url: `/api/task-service/task/repairCount/${innerCode}/${start}/${end}`,
    params
  })
}
// 获取售货机商品销量
export function getskuCollect(innerCode, start, end, params) {
  return request({
    url: `/api/order-service/report/skuCollect/${innerCode}/${start}/${end}`,
    params

  })
}
// 修改售货机类型
export function putshouhuojileixing(data) {
  return request({
    url: `/api/vm-service/vmType/${data.typeId}`,
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'put',
    data
  })
}
// 删除售货机类型
export function deleteshebeileixing(typeId) {
  return request({
    url: `/api/vm-service/vmType/${typeId}`,
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'delete'
  })
}
// 新增售货机类型
export function addshouhuojileixing(data) {
  return request({
    url: `/api/vm-service/vmType`,
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'post',
    data
  })
}
// 搜索
export function search(name) {
  return request({
    url: `/api/vm-service/vmType/search`,
    params: {
      name,
      pageIndex: 1,
      pageSize: 10
    }
  })
}

